<?php
  /**
   * @package JooS
   * @subpackage PHPackager_Folders
   */

  require_once "JooS/Helper/Abstract.php";

  abstract class JooS_PHPackager_Helper_Includepath extends JooS_Helper_Abstract {
    /**
     * @return array
     */
    public static function get_include_path() {
      require_once "JooS/Config.php";

      $folders = JooS_Config::PHPackager()->include_path();
      if (!is_array($folders))
        $folders = array();

      return $folders;
    }

    /**
     * @param array $folders
     */
    protected function set_include_path($folders) {
      require_once "JooS/Config.php";
      require_once "JooS/Event.php";
      require_once "JooS/PHPackager/Manager.php";

      JooS_Config::PHPackager()->include_path = $folders;

      JooS_Event::newInstance( JooS_PHPackager_Manager::EVENT_CONFIG_COMMIT )
        ->notify( "PHPackager", JooS_Config::PHPackager()->valueOf() );

      JooS_Event::newInstance(JooS_PHPackager_Manager::EVENT_PACKAGER_INCLUDEPATH)
        ->notify( self::get_include_path() );
    }
  }
